﻿using GoodAdmin.Core;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Yitter.IdGenerator;

namespace GoodAdmin.Web.Core;

[AppStartup(99)]
public class Startup : AppStartup
{
    public void ConfigureServices(IServiceCollection services)
    {
        //redis缓存服务
        services.AddSingleton<IRedisCacheManager, RedisCacheManager>();
        // 配置雪花Id算法机器码
        YitIdHelper.SetIdGenerator(new IdGeneratorOptions
        {
            WorkerId = 1// 取值范围0~63,默认1
        });
        StaticConfig.CustomSnowFlakeFunc = () => YitIdHelper.NextId();

        //事件总线
        services.AddEventBus();
        services.AddSqlSugar();
        
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {

    }
}
